package org.zht.dormpro.dorm.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.zht.dormpro.dorm.model.TbGoods;

public interface TbGoodsMapper {
    @Delete({
        "delete from tb_goods",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    @Insert({
        "insert into tb_goods (id, dorm_id, ",
        "goods_name, goods_damage, ",
        "record_time, goods_append, ",
        "goods_status)",
        "values (#{id,jdbcType=INTEGER}, #{dormId,jdbcType=VARCHAR}, ",
        "#{goodsName,jdbcType=VARCHAR}, #{goodsDamage,jdbcType=TINYINT}, ",
        "#{recordTime,jdbcType=BIGINT}, #{goodsAppend,jdbcType=VARCHAR}, ",
        "#{goodsStatus,jdbcType=TINYINT})"
    })
    int insert(TbGoods record);

    int insertSelective(TbGoods record);

    @Select({
        "select",
        "id, dorm_id, goods_name, goods_damage, record_time, goods_append, goods_status",
        "from tb_goods",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @ResultMap("org.zht.dormpro.dorm.mapper.TbGoodsMapper.BaseResultMap")
    TbGoods selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(TbGoods record);

    @Update({
        "update tb_goods",
        "set dorm_id = #{dormId,jdbcType=VARCHAR},",
          "goods_name = #{goodsName,jdbcType=VARCHAR},",
          "goods_damage = #{goodsDamage,jdbcType=TINYINT},",
          "record_time = #{recordTime,jdbcType=BIGINT},",
          "goods_append = #{goodsAppend,jdbcType=VARCHAR},",
          "goods_status = #{goodsStatus,jdbcType=TINYINT}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(TbGoods record);
}